﻿using System;
using System.IO;

namespace DAPNet
{
    public class SampleConverter8Bit : SampleConverter
    {
        public override Sample ReadSample(BinaryReader waveReader)
        {
            Byte value = waveReader.ReadByte();
            Sample sample = ValueToSample(value, Byte.MinValue, Byte.MaxValue);
            return sample;
        }

        public override void WriteSample(BinaryWriter waveWriter, Sample sample)
        {
            Byte value = (Byte)SampleToValue(sample, Byte.MinValue, Byte.MaxValue);
            waveWriter.Write(value);
        }
    }
}
